package com.richmond.data.bilan;

import java.util.HashMap;
import java.util.Map;

/**
 * User: csavard
 * Date: 12-09-17
 * Time: 20:47
 */
public enum Gl {
    S(6000), C(6259), M(6111), E(6180);

    private int noGl;

    private Gl(int noGl) {
        this.noGl = noGl;
    }

    public int getNoGl() {
        return noGl;
    }

    private static Map<String, Gl> GL_MAP;

    public static Gl getGl(String glDescription) {
        if (GL_MAP == null) {
            GL_MAP = new HashMap<>();
            Gl[] values = Gl.values();
            for (Gl compte : values) {
                GL_MAP.put(compte.name().toLowerCase(), compte);
            }
        }
        if (glDescription != null && !glDescription.isEmpty()) {
            return GL_MAP.get(glDescription.toLowerCase());
        } else {
            return null;
        }
    }

}
